package com.huifaapp.mall.adapter;

import android.content.Context;
import android.support.v4.app.FragmentActivity;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.huifaapp.mall.R;
import com.huifaapp.mall.bean.specificatBean;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by duanyu on 2018/1/22.
 */

public class SpecificatAdapter extends RecyclerView.Adapter<SpecificatAdapter.MyViewHolder> {
    private List<specificatBean.DataBean>list;
    private Context context;

    public SpecificatAdapter(List<specificatBean.DataBean> list, Context context) {
        this.list = list;
        this.context = context;
    }

    @Override
    public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View recyclerViewItem = LayoutInflater.from(parent.getContext()).inflate(R.layout.itme_specificat, parent, false);
        return new MyViewHolder(recyclerViewItem);
    }

    @Override
    public void onBindViewHolder(MyViewHolder holder, int position) {
        holder.itme_specificat_name.setText(list.get(position).getName());
        holder.itme_specificat_value.setText(list.get(position).getValue());
    }

    @Override
    public int getItemCount() {
        return list.size();
    }
    class MyViewHolder extends RecyclerView.ViewHolder {


        private final TextView itme_specificat_name;
        private final TextView itme_specificat_value;

        public MyViewHolder(View itemView) {
            super(itemView);
            itme_specificat_name = (TextView) itemView.findViewById(R.id.itme_specificat_name);
            itme_specificat_value = (TextView) itemView.findViewById(R.id.itme_specificat_value);

        }
    }
}
